<?php
Yii::app()->clientScript->registerCss('temp_css', '
.item{
margin: 0 5px 0 0;
border: 1px solid white;
width:51px;
float:left;
}

.gallery-holder .item img {
border: none;
}
');
$countFiles = count($files);
?>
<div id="gallery">
    <?
    if(!$files): ?>
        <div class="bigph_slide">
            <img id="big_image_slide" src="<?= Yii::app()->controller->imagePath.'images/foto_slider_zagl.png'; ?>">
        </div>
        <? else : ?>

        <? if ($countFiles >= 1) : ?>
            <div class="bigph_slide" id="panel">
                <?php
                $selected = 0;
                $img = 'http://'.$_SERVER['HTTP_HOST'].Yii::app()->request->baseUrl.
                    ImageHelper::thumb('281','221','/' . $files[$selected]->file,array('method' => 'adaptiveResize'));

                ?>
                <img id="big_image_slide" src="<?=$img?>">
            </div>
            <?php if ($countFiles != 1):?>
            <div id="sliderContent">
                    <div id="thumbs">
                        <?php for($i=0;$i<count($files);$i++):?>
                        <?php
                        $img_small = 'http://'.$_SERVER['HTTP_HOST'].Yii::app()->request->baseUrl.
                            ImageHelper::thumb('51','41','/' . $files[$i]->file,array('method' => 'adaptiveResize'));
                        $img_big = 'http://'.$_SERVER['HTTP_HOST'].Yii::app()->request->baseUrl.
                            ImageHelper::thumb('281','221','/' . $files[$i]->file,array('method' => 'resize'));

                        ?>
                        <div class="item">

                                <img src="<?=$img_small?>" height="41px" id="slide_<?=$files[$i]->id?>" onclick="change_img('<?=$img_big?>', 'slide_<?=$files[$i]->id?>')">

                        </div>
                        <?php endfor ?>
                    </div>
            </div>
            <?php endif; ?>



            <? endif; ?>
        <? endif; ?>
</div>